package thread_test;

public class SynchronizedDemo {
    // 创建锁对象
    private static Object locker = new Object();
    public static void main(String[] args) {
        Thread t = new Thread(()->{
            // 修饰代码块,进行加锁
            synchronized (locker) {
                System.out.println("hello thread!");
            }
        });
    }
}
